package com.itheima.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author :wujunjie
 * createTime :2022-12-27 11:45
 * description :
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private String host;
    private Integer code;
    private String errorMessage;
    private Object data;
    private Integer currentPage;
    private Integer size;
    private Integer total;

    public Result(String host,Integer code,String errorMessage,Object data){
        this.host=host;
        this.code=code;
        this.errorMessage=errorMessage;
        this.data=data;
    }

    public static Result success( ){
        return new Result(null,200,"success",null);
    }
    public static Result success(Object data){
        return new Result(null,200,"success",data);
    }
    public static Result mediaNewsSuccess(PagingQueryVo<MediaNewsVo> vos){

        return new Result(null, 200, null, vos.getData(), vos.getCurrentPage(), vos.getSize(), vos.getTotal());
    }
    public static Result adminChannelSuccess(PagingQueryVo<AdminChannelVo> vos){

        return new Result(null, 200, null, vos.getData(), vos.getCurrentPage(), vos.getSize(), vos.getTotal());
    }
    public static Result mediaMaterialSuccess( PagingQueryVo<MediaMaterialVo> vos){

        return new Result(null, 200, "success", vos.getData(), vos.getCurrentPage(), vos.getSize(), vos.getTotal());
    }
    public static Result error(){
        return new Result(null,501,"error",null);
    }
    public static Result error(String msg){
        return new Result(null,501,msg,null);
    }
}
